package com.lzwk.tableSql.mdb;

/**
 * @Author: CC
 * @Date: 2022/1/5 17:57
 */

import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class Jdbc {
    public static void lectureLectures(StreamTableEnvironment tableEnv){
        String sql =  "" +
                "CREATE TABLE lectureLectures " +
                "(" +
                "`id` INT NOT NULL ," +
                "`channel_id` INT," +
                "`liveroom_id` INT," +
                " PRIMARY KEY (`id`) NOT ENFORCED" +
                ")" +
                ""+"WITH (" +
                "           'connector' = 'jdbc' " +
                "           ,'url' = 'jdbc:mysql://10.1.193.23:3306/weike?characterEncoding=utf8&serverTimezone=Asia/Shanghai' " +
                "           ,'table-name' = 'lectures_lecture' " +
                "           ,'username' = 'dts1' " +
                "           ,'password' = 'HqfizIS5wax9Pzzy' " +
                "           ,'lookup.cache.max-rows' = '500' " +
                "           ,'lookup.cache.ttl' = '600000' " +
                "        )";
        tableEnv.executeSql(sql);
    }

    public static void LiveRoomChannel(StreamTableEnvironment tableEnv){
        String sql =  "" +
                "CREATE TABLE liveroom_channel " +
                "(" +
                "`id` INT NOT NULL ," +
                "`liveroom_id` INT," +
                " PRIMARY KEY (`id`) NOT ENFORCED" +
                ")" +
                ""+"WITH (" +
                "           'connector' = 'jdbc' " +
                "           ,'url' = 'jdbc:mysql://10.1.193.23:3306/weike?characterEncoding=utf8&serverTimezone=Asia/Shanghai' " +
                "           ,'table-name' = 'liveroom_channel' " +
                "           ,'username' = 'dts1' " +
                "           ,'password' = 'HqfizIS5wax9Pzzy' " +
                "           ,'lookup.cache.max-rows' = '10' " +
                "           ,'lookup.cache.ttl' = '600000' " +
                "        )";
        tableEnv.executeSql(sql);
    }
}
